var localhostPath;
(function () {


    // http://127.0.0.1:9090/cmjs/jsLib/emBase.js
    var srcScript = document.currentScript;
    var srcPath = srcScript.src; // 获取到当前script标签的src
    var idx = srcPath.indexOf("/js/lmJs/lmBase.js");
    var contexPaht = srcPath.substring(0, idx);
    localhostPath = contexPaht;
    document.write('<meta name="viewport" content="width=device-width,initial-scale=1.0">');
    document.write('<meta http-equiv="X-UA-Compatible" content="ie=edge">');

    importCss(localhostPath + '/js/leafletJs/leaflet.css');
    importCss(localhostPath + '/js/lmcss/blinkmarker.css');

    importJs(localhostPath + '/js/leafletJs/leaflet-src.js');
    importJs(localhostPath + '/js/lmJs/leaflet-tilelayer-colorizr.js');
    importJs(localhostPath + '/js/lmJs/setMapStytle.js');
    importJs(localhostPath + '/js/lmJs/mapStyle.js');
    importJs(localhostPath + '/js/lmJs/initHyMap.js');
    importJs(localhostPath + '/js/lmJs/blinkmarker.js');
    importJs(localhostPath + '/js/lmJs/DrawTool.js');
    importJs(localhostPath + '/js/lmJs/GeoUtil.js');
    importJs(localhostPath + '/js/lmJs/LineDistance.js');
    importJs(localhostPath + '/js/lmJs/markerTrack.js');
    importJs(localhostPath + '/js/lmJs/lm.geometryutil.js');

    // document.write('<link rel="stylesheet" type="text/css" href="'+localhostPath+'/js/leafletJs/leaflet.css">');
    // document.write('<link rel="stylesheet" type="text/css" href="'+localhostPath+'/js/lmcss/blinkmarker.css">');
    //
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/leafletJs/leaflet-src.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/leaflet-tilelayer-colorizr.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/setMapStytle.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/mapStyle.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/initMap.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/blinkmarker.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/DrawTool.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/GeoUtil.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/LineDistance.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/markerTrack.js"></script>');
    // document.write('<script type="text/javascript" src="'+localhostPath+'/js/lmJs/lm.geometryutil.js"></script>');
})();

function importCss(cssUrl) {
    // var link1 = document.createElement("link");
    // link1.rel = 'stylesheet';
    // link1.type = 'text/css';
    // link1.href = cssUrl;
    // console.log(link1)
    // srcScript.parentNode.appendChild(link1);
    document.write('<link rel="stylesheet" type="text/css" href="' + cssUrl + '">');
}

function importJs(scriptTarget) {
    // var sc = document.createElement("script");
    // sc.type = "text/javascript";
    // sc.src = scriptTarget;
    // srcScript.parentNode.appendChild(sc);
    document.write('<script type="text/javascript" src="'+scriptTarget+'"></script>');
    // console.log(document)
}
